home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_09_09 / 9n09104a < prev    next >
Text File  |  1991-07-08  |  737b  |  21 lines

  1.  
  2.     long *datapointer;
  3.     int ticks, stopcount;
  4.     ...
  5.      datapointer=(long *) malloc(stopcount*sizeof(long));
  6.      ticks=0;
  7.      while (ticks <=stopcount) 
  8.           {                        /*ERROR: Put last data
  9.                                    item off the end of the 
  10.                                    malloc'd array while 
  11.                                    processing a predefined
  12.                                    amount of incoming data
  13.                                    from a comm channel. */
  14.           if(dataready)
  15.                {                   /* wait for data-ready signal */
  16.                *(datapointer + ticks) = process_data();
  17.                ticks++;
  18.                } 
  19.           }
  20.  
  21.